Skip to main content

Debugging Workflows in Visual Studio

In Workflow Studio, you have the option to debug your designed workflows using either the CLR Debugger or Visual Studio. Debugging is a crucial step that allows you to examine your workflow code, observe its outcomes, and identify any potential issues.

This article will guide you through the process of debugging a workflow using Visual Studio, enabling you to efficiently troubleshoot and refine your workflow for optimal performance and reliability.

Procedure

  1. Compile and publish the workflow you wish to debug to the Workflow Server.

  2. Restart the EmpowerID Web Role Service.

note

In our example, we are debugging two test workflows. One with the newer version of Workflow Studio and Visual Studio and the other with the older version of Workflow Studio and Visual Studio while the steps are the same for both workflows, there are differences in the user interfaces (UI) of Workflow Studio and Visual Studio.

Workflow Page
EmpowerID Web Role Service
Workflow Page
New version of Workflow Studio
Workflow Page
Older version of Workflow Studio
  1. Start Visual Studio and from the File menu, select Open > File, navigate to "C:\Users<YourUserFolder>\AppData\Local\EmpowerID\DataCommon\CompilerTemp," select the .cs file for the workflow you want to debug, and click Open.

  2. If the AppData folder is not visible, go to the View menu, and then click on Hidden Items. This action will make the AppData folder visible. (Skip this step if you were able to find the AppData folder in the previous step)

Workflow Page
AppData folder is hidden.
Workflow Page
AppData folder is visible.
  1. From the CompilerTemp folder, select the .cs file for the Workflow you want to debug and then click Open.
Workflow Page
  1. Click No on the Inconsistent Line Ending dialog that appears.
Workflow Page
  1. From the Debug menu in Visual Studio, navigate to Windows and then select Exception Settings. Choose both the Thrown and User-unhandled options for Common Language Runtime Exceptions. If you're using the latest version of Visual Studio, simply check the Common Language Runtime Exceptions option, and then click OK.
Workflow Page
Exception Settings
Workflow Page
When using Visual Studio 2019 or later versions
Workflow Page
When using Visual Studio 2013 or previous versions
  1. From the Debug menu of Visual Studio, click on the Attach to Process menu item, select all w3wp.exe processes in the Available Processes pane and then click Attach.
Workflow Page
When using Visual Studio 2019 or later versions
Workflow Page
When using Visual Studio 2013 or previous versions
  1. From the .cs file for the workflow, place a breakpoint in the code editor where desired.
Workflow Page
When using Visual Studio 2019 or later versions
Workflow Page
When using Visual Studio 2013 or previous versions
  1. Run the workflow. When the workflow process reaches the breakpoint placed in the .cs file, the process will stop, allowing you to step through the code and observe what is occurring from Visual Studio.
Workflow Page
Workflow Page
info

If you make changes to the source code for the workflow, be sure to republish the workflow. Otherwise, the symbols used when debugging will not match.